Skip to main content

How Do I Create a Custom Callback for the .NET Engine?

info

The .NET Engine ships with powerful extensibility hooks that let you intercept and influence document generation. Custom Callbacks give you programmatic control over how tag select statements are evaluated, allowing you to modify selects or enforce rules at runtime.

Overview

Custom Callbacks are invoked by the Engine each time a tag's select statement is evaluated during document generation. This lets you:

  • Rewrite selects dynamically — inspect the incoming select string and return a modified version before the Engine processes it.
  • Enforce data-access rules — throw an exception to block generation when a select references data your application deems prohibited (for example, a customer's private address fields).

These are just two examples of what custom callbacks make possible. Because the callback receives the raw select string and can return any replacement value or raise an error, you can build virtually any custom logic around your data access patterns.

How It Works

The Engine looks for a custom callback class whose DLL path is set via the callback.class property in your App.config file. When the Engine finds the DLL it invokes the callback for every tag select. Your implementation can:

  1. Return the original select unchanged to let normal processing continue.
  2. Return a different select string to substitute new logic or data paths.
  3. Throw an exception to halt generation and surface an error to the caller.
note

The callback.class property must be set to an absolute path to the DLL. This is a .NET Framework security requirement specific to this property.

Sample Project

A complete working example is available in the Fluent Code Samples repository:

Embedded .NET Engine Custom Callbacks Sample